import dt from '@dt/dt'

let _this = null

function options(vm, head) {
  _this = vm
  return [
    {
      field: 'handles',
      title: '',
      width: 60,
      slots: {
        default: (params, h) => {
          return [h('Radio', {
            props: {
              value: _this.selected == params.row.userId,
              disabled: _this.receiverFlag && params.row.isReceiver != 1
            },
            on: {
              'on-change': () => {
                _this.selected = params.row.userId
                _this.userName = `${params.row.userName}(${params.row.workNo})`
              }
            }
          })]
        }
      }
    },
    {
      field: 'userName',
      title: '',
      slots: {
        default: (params, h) => {
          return params.row.isReceiver == 1 && _this.receiverFlag ?
            `${params.row.userName}（承接人）` : params.row
            .userName
        }
      }
      // slots: {
      //   default: (params, h) => {
      //     return params.row.isReceiver == 1 && _this.receiverFlag ?
      //       `${params.row.userName}（承接人）` : params.row
      //       .userName
      //   }
      // }
    },
    // {
    //   field: 'phone',
    //   title: '',
    // },
  ]
}

export default {
  options
}